package com.csht.service;

import java.util.List;
import java.util.Map;

import com.csht.model.CshtGoods;
import com.csht.page.PagerModel;
import com.csht.vo.goods.GoodsDetails;
import com.csht.vo.index.shangpinzhangqu.CshtGoodsVo_2;
import com.csht.vo.index.tenGoods.CshtGoodsVo;
import com.csht.vo.my.CshtGoodsVo_3;
import com.csht.vo.my.GoodsAndUserVo;

public interface CshtGoodsService {

	/**
	 * 根据每日十件的商品id查询商品
	 * @return
	 * @throws Exception
	 */
	public CshtGoodsVo getGoodsByGoodsId(Integer goodsId) throws Exception;
	
	/**
	 * 随机查询十条商品id
	 * @return
	 * @throws Exception
	 */
	public List<Integer> suiJiGetTenGoodsId() throws Exception;
	
	/**
	 * 根据二级菜单id查找商品
	 * @param twoMenuId
	 * @return
	 * @throws Exception
	 */
	public List<CshtGoodsVo_2> getGoodsByTwoMenuId(Integer twoMenuId) throws Exception;
	
	/**
	 * 有用户登录时，随机查询十条商品记录封装到每日十件区
	 * @param goodsTradeSchool
	 * @return
	 * @throws Exception
	 */
	public List<CshtGoodsVo> getTenGoodsToLoginUser(String goodsTradeSchool) throws Exception;
	
	/**
	 * 根据用户id查找该用户正在出售商品的数量
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public Integer getGoodsNumberByLoginUser(Integer userId) throws Exception;
	
	/**
	 * 根据定位地址变化查找商品（每日十件区）
	 * @param address
	 * @return
	 * @throws Exception
	 */
	public List<CshtGoodsVo> getGoodsByAddress(String address) throws Exception;
	
	/**
	 * 定位改变时，根据二级菜单id和用户地址查找商品
	 * @param twoMenuId
	 * @param position
	 * @return
	 * @throws Exception
	 */
	public List<CshtGoodsVo_2> getGoodsByTwoMenuIdAndposition(Map<String, String> tIdAndPName) throws Exception;
	
	/**
	 * 根据商品id查找商品
	 * @param goodsId
	 * @return
	 * @throws Exception
	 */
	public CshtGoodsVo_3 getGoodsByGoodsId_2(Integer goodsId) throws Exception;
	
	/**
	 * 根据用户id查找商品出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<CshtGoodsVo_3> getSellGoodsByUserId(Map<String, Integer> res) throws Exception;
	
	/**
	 * 根据商品id查询商品(商品详细页按商品id查询商品)
	 * @param GoodsId
	 * @return
	 * @throws Exception
	 */
	public GoodsDetails getGoodsDetailData(Integer goodsId) throws Exception;
	
	/**
	 * 根据用户id随机抽取6条商品，除本商品外(商品详细页按商品id查询商品)
	 * @param GoodsId
	 * @return
	 * @throws Exception
	 */
	public List<CshtGoods> getGoodsDetailToSixGoods(Map<String, Integer> res) throws Exception;
	
	/**
	 * 添加商品并返回主键id
	 * @param cshtGoods
	 * @throws Exception
	 */
	public void insertGoods(CshtGoods cshtGoods) throws Exception;
	
	/**
	 * 更新商品封面图
	 * @param cshtGoods
	 * @throws Exception
	 */
	public void updateGoodsImapath(CshtGoods cshtGoods) throws Exception;
	
	/**
	 * 根据商品id查找商品
	 * @param goodsId
	 * @return
	 * @throws Exception
	 */
	public CshtGoods selectGoodsById(Integer goodsId) throws Exception;
	
	/**
	 * 根据商品id更新goods_state为"已下架"
	 * @param goodsId
	 * @throws Exception
	 */
	public void updateGoodsStateById(Integer goodsId) throws Exception;
	
	/**
	 * 根据商品id更新goods_state为"出售中"
	 * @param goodsId
	 * @throws Exception
	 */
	public void updateGoodsStateSellById(Integer goodsId) throws Exception;
	
	/**
	 * 根据商品id更新goods_state为"已出售"
	 * @param goodsId
	 * @throws Exception
	 */
	public void updateGoodsStateSuccessById(Integer goodsId) throws Exception;
	
	/**
	 * 根据一级菜单查找出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsByOneMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据二级菜单查找出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsByTwoMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据三级菜单查找出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsByThreeMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据关键词搜索商品(一、二、三级菜单，商品标题、品牌)
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsBysousuo(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据品牌id查找出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsByBrandId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据一级菜单id查找出售中的商品的总数量
	 * @param oneMenuId
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsCountByOneMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据二级菜单id查找出售中的商品的总数量
	 * @param twoMenuId
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsCountByTwoMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据三级菜单id查找出售中的商品的总数量
	 * @param threeMenuId
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsCountByThreeMenuId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据品牌id查找出售中的商品的总数量
	 * @param threeMenuId
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsCountByBrandId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据关键词搜索商品(一、二、三级菜单，商品标题、品牌)的总数量
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsBysousuoCount(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据商品id更新goods_state为"交易中"
	 * @param goodsId
	 * @throws Exception
	 */
	public void updateGoodsStateTradingById(Integer goodsId) throws Exception;
	
	/**
	 * 根据用户id查找出售中的商品
	 * @param res
	 * @return
	 * @throws Exception
	 */
	public PagerModel<GoodsAndUserVo> selectGoodsListByUserId(Map<String, Object> res) throws Exception;
	
	/**
	 * 根据用户id查找出售中的商品总数量
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public Integer selectGoodsListByUserIdCount(Integer userId) throws Exception;
	
}
